import moment from "moment";
//处理时间 
export const formatTime = (date:any) => {
  return moment(date).format('YYYY-MM-DD HH:mm:ss');
};

// 防抖函数
export const debounce = (func: Function, wait: number) => {
  let timeout: NodeJS.Timeout | null = null;
  return function executedFunction(...args: any[]) {
    const later = () => {
      timeout = null;
      func(...args);
    };
    if (timeout) clearTimeout(timeout);
    timeout = setTimeout(later, wait);
  };
};